//
//  ARSearchViewController.m
//  AriseSamePro
//
//  Created by 包日守 on 15/10/27.
//  Copyright © 2015年 Arise. All rights reserved.
//

#import "ARSearchViewController.h"

#import "SearchView.h"
#import "ScanViewController.h"
#import "ChannelTableViewController.h"
#import "ARChannelTableViewFactory.h"

@interface ARSearchViewController ()<SearchViewDelegate>

@end

@implementation ARSearchViewController


- (void) viewWillDisappear:(BOOL)animated
{
    //self.navigationController.navigationBarHidden = YES;
    
    self.navigationController.navigationBarHidden = NO;

}

- (void) viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBarHidden = YES;


}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"SearchView" owner:nil options:nil];
    SearchView *searchV = [array lastObject];
    
    searchV.delegate = self;
    
    [self.view addSubview:searchV];
    
}

#pragma mark - searchViewDelegate
- (void) searchViewControllerBACK
{
    [self.navigationController popViewControllerAnimated:YES];

}


- (void) scanViewControllerIN
{
    ScanViewController *scanView = [[ScanViewController alloc] initWithNibName:@"ScanViewController" bundle:nil];
    
    [self.navigationController pushViewController:scanView animated:YES];

}

- (void) searchViewcontrollerINWithIndex:(NSString *)index WithCate:(NSNumber *)cate WithTitle:(NSString *)title
{
    
    ChannelTableViewController *channelVC = [ARChannelTableViewFactory channelTableViewWithCate:cate.stringValue WithTitle:title WithIndex:index];
    
    if (channelVC) {
        [self.navigationController pushViewController:channelVC animated:YES];
    }
    /*
    
    if (cate.intValue == 8 || cate.intValue == 3) {
        ChannelTableViewController *channelVC = [[ChannelTableViewController alloc] init];
        
        
        channelVC.index = index;
        channelVC.cate = cate.stringValue;
        channelVC.title = title;
        
        [self.navigationController pushViewController:channelVC animated:YES];
    }
*/
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
